import time

import jwt

from libs.app_helper import resp_success


def get_token(request):
    GET = request.GET
    member_id = GET.get('member_id', '')
    now_time = time.time()
    exp = int(now_time + 1)
    token = jwt.encode({
        'member_id': member_id,
        'exp': int(now_time + exp)
    }, 'ShareShop', algorithm='HS256')
    return resp_success(token=token)
